<template>
  <div>
    <!-- 资产负债表提报 -->

    <TopFilter :list="topFilterList" :cols="3" @filterChange="changeHandle" @resetChange="resetChange" @onCollapse="collapseHandle"></TopFilter>

    <Spin :spinning="exportLoading" tip="Loading...">
      <FilterTable
        ref="table"
        columnsRef="qjhBalanceSheetSubmit"
        :height="'auto'"
        :isToperInfo="false"
        :isColumnFilter="false"
        :isSelectColumn="false"
        :columns="columns"
        :dataSource="tableList"
        :cellstyles="cellstyles"
        :onSyncTableData="tableChangeFun"
        :onColumnsChange="columns => (this.columns = columns)"
      >
        <template slot="controls">
            <el-button size="small" type="text" style="font-size:14px; font-weight:bold;margin-right:20px;color:red;width: calc(100vw - 420px);text-align: left;">
             <span v-text="`当前状态：${this.currStatus}`"></span>
           </el-button>
          
          <el-button size="small" type="primary" @click="importHandle">导 入</el-button>
          <multiuse-button size="small" type="primary" :disabled="!reportId" :click="exportHandle">导 出</multiuse-button>
        </template>
      </FilterTable>
      <div style="height:30px;"></div>
      <FormPanel ref="formPanel" :list="formList" @formChange="formChangeHandle" :isSubmitBtn="false" :collapse="false" />
      <div
        :style="{
          zIndex: 9,
          borderTop: '1px solid #e9e9e9',
          padding: '10px 20px',
          background: '#fff',
          textAlign: 'center'
        }"
      >
        <multiuse-button size="small" type="primary" v-show="isShow" :disabled="isDisabled" :click="dataHandle.bind(this, 60781002)">提 交</multiuse-button>
        <multiuse-button size="small" type="primary" v-show="isShow" :disabled="isDisabled" :click="dataHandle.bind(this, 60781001)">保 存</multiuse-button>
      </div>
    </Spin>

    <BaseDialog :visible.sync="isImport" title="数据导入" destroyOnClose :containerStyle="{ height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px' }">
      <ImportFile :importData="formData" @close="emitCloseHandler" />
    </BaseDialog>
  </div>
</template>
<script>
import moment from 'moment';
import { getOwnerCode } from '@/assets/js/auth';
import { dictionary } from '@/utils/dictMixin';
import { exportExcelFile } from '@/utils/index';
import { queryList, exportExcel, saveOne } from '@/api/dealerFinance/CRReportManage/BalanceSheetSubmit';
import { getLoginUser } from '@/api/cms-api/projectOperating/program/departmentInquire'; //获取登录信息
import ImportFile from '../ImportFile';

export default {
  name: 'BalanceSheetSubmit',
  mixins: [dictionary],
  components: {
    ImportFile
  },
  data() {
    this.BaseTable = null;
    this.saveData = null;
    this.conf = { add: '新增', edit: '编辑', show: '明细' };

    return {
      topFilterList: this.createdFrom(),
      columns: this.createdTable(),
      formList: this.createdFrom1(),
      dealerName: '',
      exportLoading: false,
      isImport: false,
      isShow: true,
      formData: {},
      tableList: [],
      cellstyles: [],
      isDisabled: false,
      reportId: '',
      year: moment().format('YYYY'),
      month: moment().format('MM'),
      currStatus:'',
    };
  },
  created() {
    this.getDealerName();
    this.getList(moment().format('YYYY'), moment().format('MM'));
  },
  mounted() {
    this.BaseTable = this.$refs.table.$refs.pageTable;
  },

  methods: {
    // 获取登录信息
    async getDealerName() {
      const res = await getLoginUser();
      if (res.resultCode == 200) {
        this.dealerName = res.data.dealerName;
      }
    },
    tableChangeFun(val) {
      // 流动资产合计
      let ncldzchj = 0;
      let qmldzchj = 0;
      // 流动负债合计
      let ncldfzhj = 0;
      let qmldfzhj = 0;
      // 长期投资合计
      let nccqtzhj = 0;
      let qmcqtzhj = 0;
      // 长期负债合计
      let nccqfzhj = 0;
      let qmcqfzhj = 0;

      if (val && val.length > 0) {
        // 设置不可编辑-行列
        let arr = [];
        let disArr1 = [];
        let disArr2 = [];

        val.map((x, i) => {
          arr.push(val[i]);
          if (i == 0 || i == 1 || i == 2 || i == 16 || i == 17 || i == 20 || i == 21 || i == 24 || i == 26 || i == 30 || i == 31 || i == 35 || i == 36 || i == 38) {
            disArr1.push(val[i]);
          }
          if (i == 0 || i == 1 || i == 2 || i == 16 || i == 17 || i == 23 || i == 24 || i == 26 || i == 27 || i == 28 || i == 29 || i == 32 || i == 37 || i == 38) {
            disArr2.push(val[i]);
          }

          if (i > 1) {
            if (i == 2 || i == 17) {
              x.column3 = ' ';
              x.column4 = ' ';
              x.column7 = ' ';
              x.column8 = ' ';
            } else if (i == 24 || i == 27 || i == 28 || i == 29) {
              x.column7 = ' ';
              x.column8 = ' ';
            } else if (i == 21 || i == 31 || i == 36) {
              x.column3 = ' ';
              x.column4 = ' ';
            }
          }
          if (i > 2 && i < 16) {
            ncldzchj += x.column3 * 10000;
            qmldzchj += x.column4 * 10000;
            ncldfzhj += x.column7 * 10000;
            qmldfzhj += x.column8 * 10000;
          }
          if (i > 17 && i < 20) {
            nccqtzhj += x.column3 * 10000;
            qmcqtzhj += x.column4 * 10000;
          }
          if (i > 17 && i < 23) {
            nccqfzhj += x.column7 * 10000;
            qmcqfzhj += x.column8 * 10000;
          }
        });
        this.BaseTable.SET_CELL_UNEDITABLE(arr, 'column1', true);
        this.BaseTable.SET_CELL_UNEDITABLE(arr, 'column2', true);
        this.BaseTable.SET_CELL_UNEDITABLE(arr, 'column5', true);
        this.BaseTable.SET_CELL_UNEDITABLE(arr, 'column6', true);

        this.BaseTable.SET_CELL_UNEDITABLE(disArr1, 'column3', true);
        this.BaseTable.SET_CELL_UNEDITABLE(disArr1, 'column4', true);
        this.BaseTable.SET_CELL_UNEDITABLE(disArr2, 'column7', true);
        this.BaseTable.SET_CELL_UNEDITABLE(disArr2, 'column8', true);

        // 流动资产合计 14=1+2+3+4+5+6+7+8+9+10+11+12+13
        val[16].column3 = ncldzchj / 10000;
        val[16].column4 = qmldzchj / 10000;
        // 流动负债合计 91=68+69+70+71+72+74+75+80+81+82+83+86+90
        val[16].column7 = ncldfzhj / 10000;
        val[16].column8 = qmldfzhj / 10000;
        // 长期投资合计
        val[20].column3 = nccqtzhj / 10000;
        val[20].column4 = qmcqtzhj / 10000;
        // 长期负债合计
        val[23].column7 = nccqfzhj / 10000;
        val[23].column8 = qmcqfzhj / 10000;
        // 固定资产净值
        val[24].column3 = (val[22].column3 * 10000 - val[23].column3 * 10000) / 10000;
        val[24].column4 = (val[22].column4 * 10000 - val[23].column4 * 10000) / 10000;
        // 固定资产净额
        val[26].column3 = (val[24].column3 * 10000 - val[25].column3 * 10000) / 10000;
        val[26].column4 = (val[24].column4 * 10000 - val[25].column4 * 10000) / 10000;
        // 负债合计
        val[26].column7 = (val[16].column7 * 10000 + val[23].column7 * 10000 + val[25].column7 * 10000) / 10000;
        val[26].column8 = (val[16].column8 * 10000 + val[23].column8 * 10000 + val[25].column8 * 10000) / 10000;
        // 固定资产合计
        val[30].column3 = (val[26].column3 * 10000 + val[27].column3 * 10000 + val[28].column3 * 10000 + val[29].column3 * 10000) / 10000;
        val[30].column4 = (val[26].column4 * 10000 + val[27].column4 * 10000 + val[28].column4 * 10000 + val[29].column4 * 10000) / 10000;
        // 实收资本净额
        val[32].column7 = (val[30].column7 * 10000 - val[31].column7 * 10000) / 10000;
        val[32].column8 = (val[30].column8 * 10000 - val[31].column8 * 10000) / 10000;
        // 无形资产及其他资产合计
        val[35].column3 = (val[32].column3 * 10000 + val[33].column3 * 10000 + val[34].column3 * 10000) / 10000;
        val[35].column4 = (val[32].column4 * 10000 + val[33].column4 * 10000 + val[34].column4 * 10000) / 10000;
        // 所有者权益合计
        val[37].column7 = (val[32].column7 * 10000 + val[33].column7 * 10000 + val[34].column7 * 10000 + val[36].column7 * 10000) / 10000;
        val[37].column8 = (val[32].column8 * 10000 + val[33].column8 * 10000 + val[34].column8 * 10000 + val[36].column8 * 10000) / 10000;
        // 资产总计
        val[38].column3 = (val[16].column3 * 10000 + val[20].column3 * 10000 + val[30].column3 * 10000 + val[35].column3 * 10000 + val[37].column3 * 10000) / 10000;
        val[38].column4 = (val[16].column4 * 10000 + val[20].column4 * 10000 + val[30].column4 * 10000 + val[35].column4 * 10000 + val[37].column4 * 10000) / 10000;
        // 负债和所有者权益总计
        val[38].column7 = (val[26].column7 * 10000 + val[37].column7 * 10000) / 10000;
        val[38].column8 = (val[26].column8 * 10000 + val[37].column8 * 10000) / 10000;

        // 判断标红
        this.cellstyles = [];
        this.isDisabled = false;

        if (val[38].column3 != val[38].column7) {
          this.isDisabled = true;
          this.cellstyles.push({ row: val[38], dataIndex: 'column3', styles: { backgroundColor: 'red' } });
          this.cellstyles.push({ row: val[38], dataIndex: 'column7', styles: { backgroundColor: 'red' } });
        }
        if (val[38].column4 != val[38].column8) {
          this.isDisabled = true;

          this.cellstyles.push({ row: val[38], dataIndex: 'column4', styles: { backgroundColor: 'red' } });
          this.cellstyles.push({ row: val[38], dataIndex: 'column8', styles: { backgroundColor: 'red' } });
        }
        // 保存提交的数据
        this.saveData = {
          reportYear: this.year, // 提报年度
          reportMonth: this.month, // 提报月度
          // 货币资金
          nchbzj: val[3].column3,
          qmhbzj: val[3].column4,

          // 短期投资
          ncnqtz: val[4].column3,
          qmnqtz: val[4].column4,

          // 应收票据
          ncyspj: val[5].column3,
          qmyspj: val[5].column4,
          // 应收股利
          ncysgl: val[6].column3,
          qmysgl: val[6].column4,
          // 应收利息
          ncyslx: val[7].column3,
          qmyslx: val[7].column4,
          // 应收账款
          ncyszk: val[8].column3,
          qmyszk: val[8].column4,
          // 其他应收款
          ncqtysk: val[9].column3,
          qmqtysk: val[9].column4,
          // 预付账款
          ncyfzk: val[10].column3,
          qmyfzk: val[10].column4,
          // 应收补贴款
          ncysbtk: val[11].column3,
          qmysbtk: val[11].column4,
          // 存  货
          ncch: val[12].column3,
          qmch: val[12].column4,
          // 待摊费用
          ncdtfy: val[13].column3,
          qmdtfy: val[13].column4,
          // 一年内到期的长期债权投资
          ncynndqdcqzqtz: val[14].column3,
          qmynndqdcqzqtz: val[14].column4,
          // 其他流动资产
          ncqtldzj: val[15].column3,
          qmqtldzj: val[15].column4,
          // 流动资产合计
          ncldzchj: val[16].column3,
          qmldzchj: val[16].column4,
          // 长期股权投资
          nccqgqtz: val[18].column3,
          qmcqgqtz: val[18].column4,
          // 长期债权投资
          nccqzqtz: val[19].column3,
          qmcqzqtz: val[19].column4,
          // 长期投资合计
          nccqtzhj: val[20].column3,
          qmcqtzhj: val[20].column4,
          // 固定资产原价
          ncgdzcyj: val[22].column3,
          qmgdzcyj: val[22].column4,
          // 减：累计折旧
          ncljzj: val[23].column3,
          qmljzj: val[23].column4,
          // 固定资产净值
          ncgdzcjz: val[24].column3,
          qmgdzcjz: val[24].column4,
          // 固定资产减值准备
          ncgdzcjzzb: val[25].column3,
          qmgdzcjzzb: val[25].column4,
          // 固定资产净额
          ncgdzcje: val[26].column3,
          qmgdzcje: val[26].column4,
          // 工程物资
          ncgcwz: val[27].column3,
          qmgcwz: val[27].column4,
          // 在建工程
          nczjgc: val[28].column3,
          qmzjgc: val[28].column4,
          // 固定资产清理
          ncgdzcql: val[29].column3,
          qmgdzcql: val[29].column4,
          // 固定资产合计
          ncgdzchj: val[30].column3,
          qmgdzchj: val[30].column4,
          // 无形资产
          ncwxzc: val[32].column3,
          qmwxzc: val[32].column4,
          // 长期待摊费用
          nccqdtfy: val[33].column3,
          qmcqdtfy: val[33].column4,
          // 其他长期资产
          ncqtcqzc: val[34].column3,
          qmqtcqzc: val[34].column4,
          // 无形资产及其他资产合计
          ncwxzcjqtzchj: val[35].column3,
          qmwxzcjqtzchj: val[35].column4,
          // 递延税款借项
          ncdyskjx: val[37].column3,
          qmdyskjx: val[37].column4,
          // 资产总计
          nczczj: val[38].column3,
          qmzczj: val[38].column4,

          // 短期借款
          ncdqjk: val[3].column7,
          qmdqjk: val[3].column8,
          // 应付票据
          ncyfpj: val[4].column7,
          qmyfpj: val[4].column8,
          // 应付账款
          ncyifzk: val[5].column7,
          qmyifzk: val[5].column8,
          // 预收账款
          ncyuszk: val[6].column7,
          qmyuszk: val[6].column8,
          // 应付职工薪酬
          ncyfzgxc: val[7].column7,
          qmyfzgxc: val[7].column8,
          // 应付股利
          ncyfgl: val[8].column7,
          qmyfgl: val[8].column8,
          // 应交税金
          ncyjsj: val[9].column7,
          qmyjsj: val[9].column8,
          // 其他应交款
          ncqtyjk: val[10].column7,
          qmqtyjk: val[10].column8,
          // 其他应付款
          ncqtyfk: val[11].column7,
          qmqtyfk: val[11].column8,
          // 预提费用
          ncytfy: val[12].column7,
          qmytfy: val[12].column8,
          // 预计负债
          ncyjfz: val[13].column7,
          qmyjfz: val[13].column8,
          // 一年内到期的长期负债
          ncynndqdcqfz: val[14].column7,
          qmynndqdcqfz: val[14].column8,
          // 其他流动负债
          ncqtldfz: val[15].column7,
          qmqtldfz: val[15].column8,
          // 流动负债合计
          ncldfzhj: val[16].column7,
          qmldfzhj: val[16].column8,
          // 长期借款
          nccqjk: val[18].column7,
          qmcqjk: val[18].column8,
          // 应付债券
          ncyfzq: val[19].column7,
          qmyfzq: val[19].column8,
          // 长期应付款
          nccqyfk: val[20].column7,
          qmcqyfk: val[20].column8,
          // 专项应付款
          nczxyfk: val[21].column7,
          qmzxyfk: val[21].column8,
          // 其他长期负债
          ncqtcqfz: val[22].column7,
          qmqtcqfz: val[22].column8,
          //  长期负债合计
          nccqfzhj: val[23].column7,
          qmcqfzhj: val[23].column8,
          //  递延税款贷项
          ncdyskdx: val[25].column7,
          qmdyskdx: val[25].column8,
          // 负债合计
          ncfzhj: val[26].column7,
          qmfzhj: val[26].column8,
          //  实收资本
          ncsszb: val[30].column7,
          qmsszb: val[30].column8,
          //  减：已归还投资
          ncyghtz: val[31].column7,
          qmyghtz: val[31].column8,
          // 实收资本净额
          ncsszbje: val[32].column7,
          qmsszbje: val[32].column8,
          // 资本公积
          nczbgj: val[33].column7,
          qmzbgj: val[33].column8,
          //  盈余公积
          ncyygj: val[34].column7,
          qmyygj: val[34].column8,
          //  其中：法定公益金
          ncfdgyj: val[35].column7,
          qmfdgyj: val[35].column8,
          //  未分配利润
          ncwfplr: val[36].column7,
          qmwfplr: val[36].column8,
          //  所有者权益合计
          ncsyzqyhj: val[37].column7,
          qmsyzqyhj: val[37].column8,

          // 负债和所有者权益总计
          ncfzhsyzqyzj: val[38].column7,
          qmfzhsyzqyzj: val[38].column8
        };
      }
      console.log(val, this.saveData, '---奥利给---');
    },
    collapseHandle() {
      this.$nextTick(() => {
        this.BaseTable.EXECUTE_RESET_HEIGHT();
      });
    },
    changeHandle(params) {
      this.year = params.yearMonth.split('-')[0];
      this.month = params.yearMonth.split('-')[1];

      this.getList(this.year, this.month);
      this.columns[this.columns.length - 1].title = `月度：${this.year}年${this.month}月`;
    },
    resetChange(params) {
      this.year = params.yearMonth.split('-')[0];
      this.month = params.yearMonth.split('-')[1];

      this.getList(this.year, this.month);
      this.columns[this.columns.length - 1].title = `月度：${this.year}年${this.month}月`;
    },
    // 导入
    importHandle() {
      this.isImport = true;
      this.formData.name = '资产负债表导入';
      this.formData.upUrl = 'https://bjev-cms-oss-public.oss-cn-beijing.aliyuncs.com/资产负债表导入.xlsx';
      this.formData.importUrl = '/api/cmscloud.wholesales/balance/upload';
    },
    emitCloseHandler(val, type) {
      this.isImport = val;
      if (type === 'refresh') {
        // 重新加载
        this.getList(this.year, this.month);
      }
    },
    // 表单数据
    formChangeHandle(val) {
      this.saveData = Object.assign({}, this.saveData, val);
    },
    // 保存提交
    async dataHandle(status) {
      console.log(this.BaseTable.GET_REQUIRED_ERROR(), '---奥利给---');
      if (this.BaseTable.GET_REQUIRED_ERROR() != null) return;

      this.saveData.id = this.reportId ? this.reportId : ''; // Id
      this.saveData.balanceStatus = status; // 状态
      this.saveData.checkDesc = this.formList[0].initialValue;

      const res = await saveOne(this.saveData);
      if (res.resultCode == 200) {
        this.$notify.success({ title: '提示信息', message: '操作成功' });
        this.getList(this.year, this.month);
      }
    },
    // 查询列表
    async getList(Year = '', Month = '') {
      this.exportLoading = true;
      const res = await queryList({ reportYear: Year, reportMonth: Month });
      this.reportId = '';
      this.tableList = [];
      this.formList[0].initialValue = '';

      if (res.resultCode == 200) {
        if (res.data) {
          const data = res.data; // 表格

          this.reportId = data.id; // 导出传id
          this.currStatus = this.createDictText(data.balanceStatus, '6078');

          this.tableList = [
            {
              column1: '编制单位:',
              column2: data.dealerCode,
              column3: data.dealerName,
              column4: ' ',
              column5: ' ',
              column6: ' ',
              column7: ' ',
              column8: '单位：元'
            },
            {
              column1: '资    产',
              column2: '行次',
              column3: '年初数',
              column4: '期末数',
              column5: '负债和股东权益',
              column6: '行次',
              column7: '年初数',
              column8: '期末数'
            },
            {
              column1: '流动资产：',
              column2: ' ',
              column3: ' ',
              column4: ' ',
              column5: '流动负债：',
              column6: ' ',
              column7: ' ',
              column8: ' '
            },
            {
              column1: '货币资金',
              column2: '1',
              column3: data.nchbzj,
              column4: data.qmhbzj,
              column5: '短期借款',
              column6: '68',
              column7: data.ncdqjk,
              column8: data.qmdqjk
            },
            {
              column1: '短期投资',
              column2: '2',
              column3: data.ncnqtz,
              column4: data.qmnqtz,
              column5: '应付票据',
              column6: '69',
              column7: data.ncyfpj,
              column8: data.qmyfpj
            },
            {
              column1: '应收票据',
              column2: '3',
              column3: data.ncyspj,
              column4: data.qmyspj,
              column5: '应付账款',
              column6: '70',
              column7: data.ncyifzk,
              column8: data.qmyifzk
            },
            {
              column1: '应收股利',
              column2: '4',
              column3: data.ncysgl,
              column4: data.qmysgl,
              column5: '预收账款',
              column6: '71',
              column7: data.ncyuszk,
              column8: data.qmyuszk
            },
            {
              column1: '应收利息',
              column2: '5',
              column3: data.ncyslx,
              column4: data.qmyslx,
              column5: '应付职工薪酬',
              column6: '72',
              column7: data.ncyfzgxc,
              column8: data.qmyfzgxc
            },
            {
              column1: '应收账款',
              column2: '6',
              column3: data.ncyszk,
              column4: data.qmyszk,
              column5: '应付股利',
              column6: '74',
              column7: data.ncyfgl,
              column8: data.qmyfgl
            },
            {
              column1: '其他应收款',
              column2: '7',
              column3: data.ncqtysk,
              column4: data.qmqtysk,
              column5: '应交税金',
              column6: '75',
              column7: data.ncyjsj,
              column8: data.qmyjsj
            },
            {
              column1: '预付账款',
              column2: '8',
              column3: data.ncyfzk,
              column4: data.qmyfzk,
              column5: '其他应交款',
              column6: '80',
              column7: data.ncqtyjk,
              column8: data.qmqtyjk
            },
            {
              column1: '应收补贴款',
              column2: '9',
              column3: data.ncysbtk,
              column4: data.qmysbtk,
              column5: '其他应付款',
              column6: '81',
              column7: data.ncqtyfk,
              column8: data.qmqtyfk
            },
            {
              column1: '存  货',
              column2: '10',
              column3: data.ncch,
              column4: data.qmch,
              column5: '预提费用',
              column6: '82',
              column7: data.ncytfy,
              column8: data.qmytfy
            },
            {
              column1: '待摊费用',
              column2: '11',
              column3: data.ncdtfy,
              column4: data.qmdtfy,
              column5: '预计负债',
              column6: '83',
              column7: data.ncyjfz,
              column8: data.qmyjfz
            },
            {
              column1: '一年内到期的长期债权投资',
              column2: '12',
              column3: data.ncynndqdcqzqtz,
              column4: data.qmynndqdcqzqtz,
              column5: '一年内到期的长期负债',
              column6: '86',
              column7: data.ncynndqdcqfz,
              column8: data.qmynndqdcqfz
            },
            {
              column1: '其他流动资产',
              column2: '13',
              column3: data.ncqtldzj,
              column4: data.qmqtldzj,
              column5: '其他流动负债',
              column6: '90',
              column7: data.ncqtldfz,
              column8: data.qmqtldfz
            },
            {
              column1: '流动资产合计',
              column2: '14=1+2+3+4+5+6+7+8+9+10+11+12+13',
              column3: data.ncldzchj,
              column4: data.qmldzchj,
              column5: '流动负债合计',
              column6: '91=68+69+70+71+72+74+75+80+81+82+83+86+90',
              column7: data.ncldfzhj,
              column8: data.qmldfzhj
            },
            {
              column1: '长期投资：',
              column2: ' ',
              column3: ' ',
              column4: ' ',
              column5: '长期负债：',
              column6: ' ',
              column7: ' ',
              column8: ' '
            },
            {
              column1: '长期股权投资',
              column2: '15',
              column3: data.nccqgqtz,
              column4: data.qmcqgqtz,
              column5: '长期借款',
              column6: '101',
              column7: data.nccqjk,
              column8: data.qmcqjk
            },
            {
              column1: '长期债权投资',
              column2: '16',
              column3: data.nccqzqtz,
              column4: data.qmcqzqtz,
              column5: '应付债券',
              column6: '102',
              column7: data.ncyfzq,
              column8: data.qmyfzq
            },
            {
              column1: '长期投资合计',
              column2: '17=15+16',
              column3: data.nccqtzhj,
              column4: data.qmcqtzhj,
              column5: '长期应付款',
              column6: '103',
              column7: data.nccqyfk,
              column8: data.qmcqyfk
            },
            {
              column1: '固定资产：',
              column2: ' ',
              column3: ' ',
              column4: ' ',
              column5: '专项应付款',
              column6: '106',
              column7: data.nczxyfk,
              column8: data.qmzxyfk
            },
            {
              column1: '固定资产原价',
              column2: '39',
              column3: data.ncgdzcyj,
              column4: data.qmgdzcyj,
              column5: '其他长期负债',
              column6: '108',
              column7: data.ncqtcqfz,
              column8: data.qmqtcqfz
            },
            {
              column1: '减：累计折旧',
              column2: '40',
              column3: data.ncljzj,
              column4: data.qmljzj,
              column5: '长期负债合计',
              column6: '110=101+102+103+106+108',
              column7: data.nccqfzhj,
              column8: data.qmcqfzhj
            },
            {
              column1: '固定资产净值',
              column2: '41=39-40',
              column3: data.ncgdzcjz,
              column4: data.qmgdzcjz,
              column5: '递延税项：',
              column6: ' ',
              column7: ' ',
              column8: ' '
            },
            {
              column1: '减：固定资产减值准备',
              column2: '42',
              column3: data.ncgdzcjzzb,
              column4: data.qmgdzcjzzb,
              column5: '递延税款贷项',
              column6: '111',
              column7: data.ncdyskdx,
              column8: data.qmdyskdx
            },
            {
              column1: '固定资产净额',
              column2: '43=41-42',
              column3: data.ncgdzcje,
              column4: data.qmgdzcje,
              column5: '负债合计',
              column6: '114=91+110+111',
              column7: data.ncfzhj,
              column8: data.qmfzhj
            },
            {
              column1: '工程物资',
              column2: '44',
              column3: data.ncgcwz,
              column4: data.qmgcwz,
              column5: ' ',
              column6: ' ',
              column7: ' ',
              column8: ' '
            },
            {
              column1: '在建工程',
              column2: '45',
              column3: data.nczjgc,
              column4: data.qmzjgc,
              column5: ' ',
              column6: ' ',
              column7: ' ',
              column8: ' '
            },
            {
              column1: '固定资产清理',
              column2: '46',
              column3: data.ncgdzcql,
              column4: data.qmgdzcql,
              column5: '股东权益',
              column6: ' ',
              column7: ' ',
              column8: ' '
            },
            {
              column1: '固定资产合计',
              column2: '50=43+44+45+46',
              column3: data.ncgdzchj,
              column4: data.qmgdzchj,
              column5: '实收资本',
              column6: '115',
              column7: data.ncsszb,
              column8: data.qmsszb
            },
            {
              column1: '无形资产及其他资产：',
              column2: ' ',
              column3: ' ',
              column4: ' ',
              column5: '减：已归还投资',
              column6: '116',
              column7: data.ncyghtz,
              column8: data.qmyghtz
            },
            {
              column1: '无形资产',
              column2: '51',
              column3: data.ncwxzc,
              column4: data.qmwxzc,
              column5: '实收资本净额',
              column6: '117=115-116',
              column7: data.ncsszbje,
              column8: data.qmsszbje
            },
            {
              column1: '长期待摊费用',
              column2: '52',
              column3: data.nccqdtfy,
              column4: data.qmcqdtfy,
              column5: '资本公积',
              column6: '118',
              column7: data.nczbgj,
              column8: data.qmzbgj
            },
            {
              column1: '其他长期资产',
              column2: '53',
              column3: data.ncqtcqzc,
              column4: data.qmqtcqzc,
              column5: '盈余公积',
              column6: '119',
              column7: data.ncyygj,
              column8: data.qmyygj
            },
            {
              column1: '无形资产及其他资产合计',
              column2: '60=51+52+53',
              column3: data.ncwxzcjqtzchj,
              column4: data.qmwxzcjqtzchj,
              column5: '其中：法定公益金',
              column6: '120',
              column7: data.ncfdgyj,
              column8: data.qmfdgyj
            },
            {
              column1: '递延税项：',
              column2: ' ',
              column3: ' ',
              column4: ' ',
              column5: '未分配利润',
              column6: '121',
              column7: data.ncwfplr,
              column8: data.qmwfplr
            },
            {
              column1: '递延税款借项',
              column2: '61',
              column3: data.ncdyskjx,
              column4: data.qmdyskjx,
              column5: '所有者权益合计',
              column6: '122=117+118+119+121',
              column7: data.ncsyzqyhj,
              column8: data.qmsyzqyhj
            },
            {
              column1: '资产总计',
              column2: '67=14+17+50+60+61',
              column3: data.nczczj,
              column4: data.qmzczj,
              column5: '负债和所有者权益总计',
              column6: '135=114+122=67（校验）',
              column7: data.ncfzhsyzqyzj,
              column8: data.qmfzhsyzqyzj
            }
          ];
          // 驳回意见赋值
          this.formList[0].initialValue = data.checkDesc;
          if (60781002 == data.balanceStatus) {
            this.isShow = false; // 已提交数据不展示按钮
            this.columns.map(x => {
              x.editable = false;
            });
          } else {
            this.isShow = true; // 未提交数据展示按钮
            this.columns.map(x => {
              x.editable = true;
            });
          }
        } else {
          this.isShow = true; // 未提交数据展示按钮
          this.currStatus = '';
          this.columns.map(x => {
            x.editable = true;
          });
          this.tableList = [
            {
              column1: '编制单位:',
              column2: getOwnerCode(),
              column3: this.dealerName,
              column4: ' ',
              column5: ' ',
              column6: ' ',
              column7: ' ',
              column8: '单位：元'
            },
            {
              column1: '资    产',
              column2: '行次',
              column3: '年初数',
              column4: '期末数',
              column5: '负债和股东权益',
              column6: '行次',
              column7: '年初数',
              column8: '期末数'
            },
            {
              column1: '流动资产：',
              column2: ' ',
              column3: ' ',
              column4: ' ',
              column5: '流动负债：',
              column6: ' ',
              column7: ' ',
              column8: ' '
            },
            {
              column1: '货币资金',
              column2: '1',
              column3: 0,
              column4: 0,
              column5: '短期借款',
              column6: '68',
              column7: 0,
              column8: 0
            },
            {
              column1: '短期投资',
              column2: '2',
              column3: 0,
              column4: 0,
              column5: '应付票据',
              column6: '69',
              column7: 0,
              column8: 0
            },
            {
              column1: '应收票据',
              column2: '3',
              column3: 0,
              column4: 0,
              column5: '应付账款',
              column6: '70',
              column7: 0,
              column8: 0
            },
            {
              column1: '应收股利',
              column2: '4',
              column3: 0,
              column4: 0,
              column5: '预收账款',
              column6: '71',
              column7: 0,
              column8: 0
            },
            {
              column1: '应收利息',
              column2: '5',
              column3: 0,
              column4: 0,
              column5: '应付职工薪酬',
              column6: '72',
              column7: 0,
              column8: 0
            },
            {
              column1: '应收账款',
              column2: '6',
              column3: 0,
              column4: 0,
              column5: '应付股利',
              column6: '74',
              column7: 0,
              column8: 0
            },
            {
              column1: '其他应收款',
              column2: '7',
              column3: 0,
              column4: 0,
              column5: '应交税金',
              column6: '75',
              column7: 0,
              column8: 0
            },
            {
              column1: '预付账款',
              column2: '8',
              column3: 0,
              column4: 0,
              column5: '其他应交款',
              column6: '80',
              column7: 0,
              column8: 0
            },
            {
              column1: '应收补贴款',
              column2: '9',
              column3: 0,
              column4: 0,
              column5: '其他应付款',
              column6: '81',
              column7: 0,
              column8: 0
            },
            {
              column1: '存  货',
              column2: '10',
              column3: 0,
              column4: 0,
              column5: '预提费用',
              column6: '82',
              column7: 0,
              column8: 0
            },
            {
              column1: '待摊费用',
              column2: '11',
              column3: 0,
              column4: 0,
              column5: '预计负债',
              column6: '83',
              column7: 0,
              column8: 0
            },
            {
              column1: '一年内到期的长期债权投资',
              column2: '12',
              column3: 0,
              column4: 0,
              column5: '一年内到期的长期负债',
              column6: '86',
              column7: 0,
              column8: 0
            },
            {
              column1: '其他流动资产',
              column2: '13',
              column3: 0,
              column4: 0,
              column5: '其他流动负债',
              column6: '90',
              column7: 0,
              column8: 0
            },
            {
              column1: '流动资产合计',
              column2: '14=1+2+3+4+5+6+7+8+9+10+11+12+13',
              column3: 0,
              column4: 0,
              column5: '流动负债合计',
              column6: '91=68+69+70+71+72+74+75+80+81+82+83+86+90',
              column7: 0,
              column8: 0
            },
            {
              column1: '长期投资：',
              column2: ' ',
              column3: ' ',
              column4: ' ',
              column5: '长期负债：',
              column6: ' ',
              column7: ' ',
              column8: ' '
            },
            {
              column1: '长期股权投资',
              column2: '15',
              column3: 0,
              column4: 0,
              column5: '长期借款',
              column6: '101',
              column7: 0,
              column8: 0
            },
            {
              column1: '长期债权投资',
              column2: '16',
              column3: 0,
              column4: 0,
              column5: '应付债券',
              column6: '102',
              column7: 0,
              column8: 0
            },
            {
              column1: '长期投资合计',
              column2: '17=15+16',
              column3: 0,
              column4: 0,
              column5: '长期应付款',
              column6: '103',
              column7: 0,
              column8: 0
            },
            {
              column1: '固定资产：',
              column2: ' ',
              column3: ' ',
              column4: ' ',
              column5: '专项应付款',
              column6: '106',
              column7: 0,
              column8: 0
            },
            {
              column1: '固定资产原价',
              column2: '39',
              column3: 0,
              column4: 0,
              column5: '其他长期负债',
              column6: '108',
              column7: 0,
              column8: 0
            },
            {
              column1: '减：累计折旧',
              column2: '40',
              column3: 0,
              column4: 0,
              column5: '长期负债合计',
              column6: '110=101+102+103+106+108',
              column7: 0,
              column8: 0
            },
            {
              column1: '固定资产净值',
              column2: '41=39-40',
              column3: 0,
              column4: 0,
              column5: '递延税项：',
              column6: ' ',
              column7: ' ',
              column8: ' '
            },
            {
              column1: '减：固定资产减值准备',
              column2: '42',
              column3: 0,
              column4: 0,
              column5: '递延税款贷项',
              column6: '111',
              column7: 0,
              column8: 0
            },
            {
              column1: '固定资产净额',
              column2: '43=41-42',
              column3: 0,
              column4: 0,
              column5: '负债合计',
              column6: '114=91+110+111',
              column7: 0,
              column8: 0
            },
            {
              column1: '工程物资',
              column2: '44',
              column3: 0,
              column4: 0,
              column5: ' ',
              column6: ' ',
              column7: ' ',
              column8: ' '
            },
            {
              column1: '在建工程',
              column2: '45',
              column3: 0,
              column4: 0,
              column5: ' ',
              column6: ' ',
              column7: ' ',
              column8: ' '
            },
            {
              column1: '固定资产清理',
              column2: '46',
              column3: 0,
              column4: 0,
              column5: '股东权益',
              column6: ' ',
              column7: ' ',
              column8: ' '
            },
            {
              column1: '固定资产合计',
              column2: '50=43+44+45+46',
              column3: 0,
              column4: 0,
              column5: '实收资本',
              column6: '115',
              column7: 0,
              column8: 0
            },
            {
              column1: '无形资产及其他资产：',
              column2: ' ',
              column3: ' ',
              column4: ' ',
              column5: '减：已归还投资',
              column6: '116',
              column7: 0,
              column8: 0
            },
            {
              column1: '无形资产',
              column2: '51',
              column3: 0,
              column4: 0,
              column5: '实收资本净额',
              column6: '117=115-116',
              column7: 0,
              column8: 0
            },
            {
              column1: '长期待摊费用',
              column2: '52',
              column3: 0,
              column4: 0,
              column5: '资本公积',
              column6: '118',
              column7: 0,
              column8: 0
            },
            {
              column1: '其他长期资产',
              column2: '53',
              column3: 0,
              column4: 0,
              column5: '盈余公积',
              column6: '119',
              column7: 0,
              column8: 0
            },
            {
              column1: '无形资产及其他资产合计',
              column2: '60=51+52+53',
              column3: 0,
              column4: 0,
              column5: '其中：法定公益金',
              column6: '120',
              column7: 0,
              column8: 0
            },
            {
              column1: '递延税项：',
              column2: ' ',
              column3: ' ',
              column4: ' ',
              column5: '未分配利润',
              column6: '121',
              column7: 0,
              column8: 0
            },
            {
              column1: '递延税款借项',
              column2: '61',
              column3: 0,
              column4: 0,
              column5: '所有者权益合计',
              column6: '122=117+118+119+121',
              column7: 0,
              column8: 0
            },
            {
              column1: '资产总计',
              column2: '67=14+17+50+60+61',
              column3: 0,
              column4: 0,
              column5: '负债和所有者权益总计',
              column6: '135=114+122=67（校验）',
              column7: 0,
              column8: 0
            }
          ];
        }
      }else{
        this.currStatus = '';
      }
      this.exportLoading = false;
    },
    // 导出
    async exportHandle() {
      await this.$confirm('是否将Excel表格保存至本地文件夹?', '提示', {
        confirmButtonText: '下载',
        cancelButtonText: '取消',
        type: 'warning'
      })
        .then(() => {
          this.exportLoading = true;
          let param = { id: this.reportId };
          exportExcel(param)
            .then(response => {
              exportExcelFile(response.data, '资产负债表提报');
              this.exportLoading = false;
            })
            .catch(err => {
              console.log(err);
            });
        })
        .catch(() => {
          this.$message({
            type: 'info',
            message: '已取消'
          });
        });
    },

    createdFrom() {
      return [
        {
          type: 'DATE',
          label: '月度',
          fieldName: 'yearMonth',
          dateType: 'month',
          initialValue: moment().format('YYYY-MM'),
          placeholder: '请选择'
        }
      ];
    },
    createdFrom1() {
      return [
        {
          type: 'TEXT_AREA',
          label: '驳回意见',
          fieldName: 'checkDesc',
          initialValue: '',
          selfCols: 3,
          placeholder: '',
          disabled: true
        }
      ];
    },
    createdTable() {
      return [
        {
          title: '资产负债表',
          dataIndex: 'column1',
          filterType: 'input',
          align: 'center'
        },
        {
          title: '',
          dataIndex: 'column2',
          filterType: 'input',
          align: 'center'
        },
        {
          title: '',
          dataIndex: 'column3',
          filterType: 'input',
          align: 'center',
          editType: 'number',
          defaultEditable: true,
          editable: true,
          editRequired: true,
          msgtitle: '当前项',
          max: 999999999,
          min: -999999999
        },
        {
          title: '',
          dataIndex: 'column4',
          filterType: 'input',
          align: 'center',
          editType: 'number',
          defaultEditable: true,
          editable: true,
          editRequired: true,
          msgtitle: '当前项',
          max: 999999999,
          min: -999999999
        },
        {
          title: '',
          dataIndex: 'column5',
          filterType: 'input',
          align: 'center'
        },
        {
          title: '',
          dataIndex: 'column6',
          filterType: 'input',
          align: 'center'
        },
        {
          title: '',
          dataIndex: 'column7',
          filterType: 'input',
          align: 'center',
          editType: 'number',
          defaultEditable: true,
          editable: true,
          editRequired: true,
          msgtitle: '当前项',
          max: 999999999,
          min: -999999999
        },
        {
          title: `月度：${moment().format('YYYY')}年${moment().format('MM')}月`,
          dataIndex: 'column8',
          filterType: 'input',
          align: 'center',
          editType: 'number',
          defaultEditable: true,
          editable: true,
          editRequired: true,
          msgtitle: '当前项',
          max: 999999999,
          min: -999999999
        }
      ];
    }
  }
};
</script>
